<?php
namespace App\Http\Controllers\Validator;
use Validator;

/**
 * Class RoomInfoVail
 * @package App\Http\Controllers\Validator
 *房源表验证器
 */
class RoomInfoVail{

    public static function validate($params)
    {
        $return = true;
        $validator = Validator::make($params, [
            'a_id'                       =>        'required',//区县id
            'building_id'                =>        'required',//楼盘字典id
            'few_building'               =>        'required',//几号楼
            'room_number'                =>        'required',//房号
            'floor'                      =>        'required',//楼层
            'total_layer'                =>        'required',//总层
            'use_type'                   =>        'required',//用途id
            'housing_types'              =>        'required',//房屋类型（多层，高层，小高层）
            'type_of_house_sale'         =>        'required',//房屋出售类型(普通房，优质房，聚焦房)
            'disc_type'                  =>        'required',//盘类型 （公盘、私盘、特盘、封盘）
            'trading_type'               =>        'required',//交易类型(租，售，租售)
            'trading_state_type'         =>        'required',//交易状态类型(有效，无效)
            'owner_name'                 =>        'required',//业主姓名
            'owner_phone'                =>        'required',//业主电话
            'source_uid'                 =>         'required',//用户ID
            'r_d_id'                     =>        'required', //部门ID
            'status'                     =>        'required',   //房源当前状态
            'r_info'                     =>        'required'   //前台根据用途不同填写不同参数的值
        ]);
        if ($validator->fails()) {
            $return = false;
        }
        return $return;
    }

    public static function getWordbookValidate($params){
        $return = true;
        $validator = Validator::make($params, [
            'p_id'                       =>        'required',//省id
            'c_id'                       =>        'required',//市id
            'a_id'                       =>        'required',//区县id
            'w_spell'                    =>        'required' //楼盘字典首字母简拼
        ]);
        if ($validator->fails()) {
            $return = false;
        }
        return $return;
    }


}